package com.alameda.listener.strategy.impl;

import com.alameda.api.user.UserOperateLogService;
import com.alameda.base.constant.ProjectConstant;
import com.alameda.listener.strategy.api.ListenerStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 监听策略 删除操作记录
 *
 * @author Lv
 * @date 2025/3/3
 */
@Slf4j
@Component(ProjectConstant.StrategyConstant.REMOVE_OPERATE_STRATEGY)
public class RemoveOperateStrategyImpl implements ListenerStrategy {

    @Autowired
    private UserOperateLogService userOperateLogService;

    /**
     * 监听消息
     *
     * @param map 消息内容
     */
    @Override
    public void listenEvent(Map<String, Object> map) {
        String deleteSql = (String) map.get(ProjectConstant.OperateInfoPropertyConstant.SQL);
        Boolean aBoolean = userOperateLogService.deleteOperateLog(deleteSql);
        log.info("监听策略 -- 删除操作记录结果 :{}", aBoolean);
    }
}
